package fr.webeo.teambuilder.gui;

import java.awt.BorderLayout;
import java.awt.Color;

import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;

import fr.webeo.teambuilder.ao.AbstractModel;
import fr.webeo.teambuilder.ao.TeamForNPlayerModel;

/**
 * The class <strong>TeamForNPlayerPanel</strong>.
 * 
 * @author Sébastien Bordes
 * @version $Revision$ $Date$ $Name$
 * 
 * @since fr.webeo.teambuilder 1.0
 */
public class TeamForNPlayerPanel extends AbstractPanel {

    public TeamForNPlayerPanel(AbstractModel model) {
        super(model);
    }

    /**
     * Comment for <code>serialVersionUID</code>
     */
    private static final long serialVersionUID = 4159685937888438734L;

    @Override
    public void init() {

        setLayout(new BorderLayout());

        /*
         * JPanel label = new JPanel(); label.setLayout(new GridLayout(1, 2)); Font f = new Font("serif", 1, 14); JLabel equipeALB = new JLabel("Equipe A"); equipeALB.setFont(f);
         * equipeALB.setHorizontalAlignment(0); label.add(equipeALB);
         * 
         * swap = new JButton("Echanger 2 joueurs"); swap.setFont(f); swap.setHorizontalAlignment(0); swap.addActionListener(this); label.add(swap);
         * 
         * JLabel equipeBLB = new JLabel("Equipe B"); equipeBLB.setFont(f); equipeBLB.setHorizontalAlignment(0); label.add(equipeBLB); main.add(label, "North");
         */

        // TableSorter sorter = new TableSorter(getModel().getTeamTableModel());
        JTable teamTable = new JTable(getModel().getTeamTableModel());
        // sorter.setTableHeader(tableau.getTableHeader());
        // sorter.setSortingStatus(0, -1);

        teamTable.setAutoscrolls(true);
        teamTable.setShowHorizontalLines(false);
        teamTable.setGridColor(Color.GRAY);
        // teamTable.getColumn(MyTeamTableModel.NAME_COL_TEAM).setPreferredWidth(100);
        teamTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        // teamTable.addMouseListener(this);

        JScrollPane jsp = new JScrollPane(teamTable);

        this.add(jsp, "Center");

        // export2 = new JButton("Exporter les Equipes");
        // export2.addActionListener(this);
        // main.add(export2, "South");
    }

    @Override
    public void reload() {

    }

    /**
     * @see fr.webeo.teambuilder.gui.AbstractPanel#getModel()
     */
    @Override
    public TeamForNPlayerModel getModel() {
        return (TeamForNPlayerModel) super.getModel();
    }

}
